Con log:"Setting up methods" from:"Integer".

Repl methodIn: Integer.
numDigits [
   ^ (self < 10 )
      ifTrue:[|| ^1 ]
      else:[|| ^((self/10) numDigits) +1 ].
]

Repl methodIn: Integer.
toString [
   digits <- (self numDigits).
   array <- Array new: digits.
   self writeDigitToArray: array at:(digits-1).
   ^ (array toStringAsByteArrayFrom: 0 to: (array length)).
]

Repl methodIn: Integer.
writeDigitToArray: array at: i[
   array at: i set: ((self % 10)+48).
   (self < 10) 
      ifTrue:[|| self ] 
      else: [|| (self/10) writeDigitToArray: array at:(i-1) ].
]

Repl methodIn: Integer.
min: val [
    ^(self<val) ifTrue:[|| ^val.] else:[|| ^self.]
]
